<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="quizman.domain.Quiz"%>
<%@page import="java.sql.Date"%>
<%@page import="java.text.DateFormat"%>

<%@page import="java.util.Calendar"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="quizman.domain.Question"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Edit Quiz</title>
</head>
<body>
<% 
	Quiz quiz = (Quiz)request.getAttribute("quiz");
	DateFormat formatter = new SimpleDateFormat();
%>
<p>Edit a quiz.</p>
<form action="EditQuizPageController">
<label for="quizName">Quiz Name:</label> 
<input type="text" value="<%=quiz.getName()  %>" disabled="disabled"><br>
<input type="hidden" name="quizName" value="<%=quiz.getName()  %>">
<label for="length">Length in minutes:</label> 
<input type="text" name="quizLength" value="<%=quiz.getLength() %>"><br>

<% for(Question q: quiz.getQuestions()) { %>
	<div>
		<p><span class="question-name"><%= q.getName() %></span>. <%=q.getText() %> <a href="EditQuestionPageController?questionName=<%=q.getName() %>&quizName=<%=quiz.getName() %>">Edit Question</a></p>
	</div>
<% } %>

<input type="reset">
<input type="submit">
</form>
<p><a href="ViewQuizPageController?quizName=<%=quiz.getName() %>">View</a> this quiz.</p>
</body>
</html>